{% extends "base.html" %}

{% block title %}Viewing Routes{% endblock %}
{% block crumb %}&rsaquo; Viewing Routes{% endblock %}

{% block content %}
{% if all_routes %}
	{% if active_routes %}
	<h1>Listing All Active Routes</h1>
	{% else %}
	<h1>Listing All Inactive Routes</h1>
	{% endif %}
{% else %}
<h1>Listing Routes on {{region.name}}</h1>
{% endif %}
	<br>
	<table class="socialSearch">
		<thead>
		<tr>
			<th>Route Name</th>
			<th>Rating</th>
			<th>Date Set</th>
			{% if all_routes %}<th>Region</th>{% endif %}
			<th>View{% if active_routes %}/Evaluate{% endif %}</th>
			{%if setter %}<th>Edit Route</th>{% endif %}
		</tr>
		</thead>
	<tbody id="searchResults">
	  {% for route in routes %}
	  <tr onClick="window.location='/routes/rateroute/{{route.id}}';">
          <td>{{route.name}}</td>
		  <td>{{route.rating}}</td>
		  <td>{{route.date_set.date}}</td>
		  {% if all_routes %}<td>{{route.region.name}}</td>{% endif %}
		  <td><a href ="/routes/rateroute/{{route.id}}">Link</a></td>
		  {%if setter %}<td><a href ="/routes/editroute/{{route.id}}">Edit</a></td>{% endif %}
	  </tr>
	  {% endfor %}
	</tbody>
  </table>
	<br>
{%if setter and not all_routes%}
<FORM>
<INPUT TYPE="BUTTON" VALUE="Add A Route" ONCLICK="window.location.href='/routes/addroute/{{region.id}}'">
</FORM>
{%endif%}
{% endblock %}